package com.org.system
{
	import com.org.system.logging.Log;
	
	import flash.display.Stage;

	public class SystemFunction
	{
		public static const instance:SystemFunction = new SystemFunction();
		private var _stage:Stage;
		public function SystemFunction()
		{
		}
		
		public function start(stage:Stage):void
		{
			_stage = stage;
			Log.instance.init(formatLogConfig(_config.Log));
		}
		
		private var _config:Object = {
			Log: {
				loggers: [
					{name: "TraceLogger",levels: "*"},
					{name: "ConsoleLogger",levels: "*"}
				]
			}
		}
		
		private function formatLogConfig(config:*) : *
		{
			if (config != null) {
				for each (var logger:Object in config['loggers']) {
					if (logger['name'] == "ConsoleLogger") {
						logger['params'] = { stage: _stage };
					}
				}
			}
			return config;
		}
		
		
		
		
		
		
		
		
		
		
		
	}
}